package com.manage.project.biz.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.manage.framework.aspectj.lang.annotation.Log;
import com.manage.framework.aspectj.lang.enums.BusinessType;
import com.manage.project.biz.domain.BizJidiansheshiguzhangyuebaobiao;
import com.manage.project.biz.service.IBizJidiansheshiguzhangyuebaobiaoService;
import com.manage.framework.web.controller.BaseController;
import com.manage.framework.web.domain.AjaxResult;
import com.manage.common.utils.poi.ExcelUtil;
import com.manage.framework.web.page.TableDataInfo;

/**
 Controller
 *
 * @author liang
 *
 */
@RestController
@RequestMapping("/biz/jidiansheshiguzhangyuebaobiao")
public class BizJidiansheshiguzhangyuebaobiaoController extends BaseController
{
    @Autowired
    private IBizJidiansheshiguzhangyuebaobiaoService bizJidiansheshiguzhangyuebaobiaoService;

    /**
     * 查询机电设施故障月报列表
     */
//    @PreAuthorize("@ss.hasPermi('biz:jidiansheshiguzhangyuebaobiao:list')")
    @GetMapping("/list")
    public TableDataInfo list(BizJidiansheshiguzhangyuebaobiao bizJidiansheshiguzhangyuebaobiao)
    {
        startPage();
        List<BizJidiansheshiguzhangyuebaobiao> list = bizJidiansheshiguzhangyuebaobiaoService.selectBizJidiansheshiguzhangyuebaobiaoList(bizJidiansheshiguzhangyuebaobiao);
        return getDataTable(list);
    }

    /**
     * 导出机电设施故障月报列表
     */
//    @PreAuthorize("@ss.hasPermi('biz:jidiansheshiguzhangyuebaobiao:export')")
    @Log(title = "机电设施故障月报", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(BizJidiansheshiguzhangyuebaobiao bizJidiansheshiguzhangyuebaobiao)
    {
        List<BizJidiansheshiguzhangyuebaobiao> list = bizJidiansheshiguzhangyuebaobiaoService.selectBizJidiansheshiguzhangyuebaobiaoList(bizJidiansheshiguzhangyuebaobiao);
        ExcelUtil<BizJidiansheshiguzhangyuebaobiao> util = new ExcelUtil<BizJidiansheshiguzhangyuebaobiao>(BizJidiansheshiguzhangyuebaobiao.class);
        return util.exportExcel(list, "机电设施故障月报数据");
    }

    /**
     * 获取机电设施故障月报详细信息
     */
//    @PreAuthorize("@ss.hasPermi('biz:jidiansheshiguzhangyuebaobiao:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(bizJidiansheshiguzhangyuebaobiaoService.selectBizJidiansheshiguzhangyuebaobiaoById(id));
    }

    /**
     * 新增机电设施故障月报
     */
//    @PreAuthorize("@ss.hasPermi('biz:jidiansheshiguzhangyuebaobiao:add')")
    @Log(title = "机电设施故障月报", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BizJidiansheshiguzhangyuebaobiao bizJidiansheshiguzhangyuebaobiao)
    {

        return toAjax(bizJidiansheshiguzhangyuebaobiaoService.insertBizJidiansheshiguzhangyuebaobiao(bizJidiansheshiguzhangyuebaobiao));
    }

    /**
     * 修改机电设施故障月报
     */
    @Log(title = "机电设施故障月报", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BizJidiansheshiguzhangyuebaobiao bizJidiansheshiguzhangyuebaobiao)
    {
        return toAjax(bizJidiansheshiguzhangyuebaobiaoService.updateBizJidiansheshiguzhangyuebaobiao(bizJidiansheshiguzhangyuebaobiao));
    }

    /**
     * 删除机电设施故障月报
     */
//    @PreAuthorize("@ss.hasPermi('biz:jidiansheshiguzhangyuebaobiao:remove')")
    @Log(title = "机电设施故障月报", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bizJidiansheshiguzhangyuebaobiaoService.deleteBizJidiansheshiguzhangyuebaobiaoByIds(ids));
    }
}
